package com.idheima.IO.output.anli;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Test {
    public static void main(String[] args) throws IOException {
        //拷贝kunkun文件到 aikun.txt文件中
        //创建文件字节输入流对象
        FileInputStream fis = new FileInputStream("D:\\java-base-ws\\JavaAdvanceProject\\day12_IO_zifuji\\src\\com\\idheima\\IO\\kunkun.txt");
        //创建文件字节输出流对象
        FileOutputStream fos = new FileOutputStream("D:\\java-base-ws\\JavaAdvanceProject\\day12_IO_zifuji\\src\\com\\idheima\\IO\\aikun.txt");
        //创建字节数组（小推车）
        byte[] bytes = new byte[1024];
        //定义变量记录小推车容量的数据
        int len=-1;
        while((len=fis.read(bytes))!=-1){
            //把数据写出去
            fos.write(bytes,0,len);
        }
        //释放资源
        fos.close();
        fis.close();
        System.out.println("复制完毕");

    }
}
